package org.gxuwz.core.action;

import java.util.List;

import org.gxuwz.core.service.IFamilyFilesService;
import org.gxuwz.core.entity.TFamily;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;


public class FamilyFilesAction extends ActionSupport implements ModelDriven<TFamily>{
	TFamily files = new TFamily();
    List<TFamily> list;
	String houseName;
	String perscode;
	String code11;
    
    @Autowired
    IFamilyFilesService fillsService;
    
	@Override
	public TFamily getModel() {
		return files;
	}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
	
	public String list() {
		list = fillsService.getAll(houseName, perscode);
		return "list";
	}
    
	public String sava(){
		fillsService.addFamilyFilesDao(files);
		//System.out.println(files+"123456789");
		return this.list();
	}
	
	public String getByPersCode(){
		files = fillsService.getByPersCode(code11);
		return "list";
	}
	public String edit(){
		files = fillsService.getByPersCode(code11);
		return "edit";
	}
	
	public String update(){
		fillsService.update(files);
		return list();
	}
	
	public String getCodell() {
		return code11;
	}

	public void setCodell(String code11) {
		this.code11 = code11;
	}

	public String delete(){
		files = fillsService.getByPersCode(code11);
		fillsService.delete(files);
		return this.list();
	}

	public TFamily getFiles() {
		return files;
	}

	public void setFiles(TFamily files) {
		this.files = files;
	}

	public List<TFamily> getList() {
		return list;
	}

	public void setList(List<TFamily> list) {
		this.list = list;
	}

	public String getHouseName() {
		return houseName;
	}

	public void setHouseName(String houseName) {
		this.houseName = houseName;
	}

	public String getPerscode() {
		return perscode;
	}

	public void setPerscode(String perscode) {
		this.perscode = perscode;
	}

	public IFamilyFilesService getFillsService() {
		return fillsService;
	}

	public void setFillsService(IFamilyFilesService fillsService) {
		this.fillsService = fillsService;
	}
	
}


